package com.cictec.middleware.tde.rm.disp.receiver.handler;

import org.apache.mina.core.session.IoSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import com.cictec.middleware.tde.rm.disp.annotation.HandleMessages;
import com.cictec.middleware.tde.rm.disp.receiver.AbstractReceiverHandler;
import com.cictec.middleware.tde.rm.protocol.TerminalMessage;

/**
 * 数据补传
 * 
 * @author Administrator
 *
 */
@Component
@HandleMessages(0xFD)
public class TerminalSupplementsHandler extends AbstractReceiverHandler {

	private static Logger logger = LoggerFactory.getLogger(TerminalSupplementsHandler.class);

	@Override
	public void handleMessage(TerminalMessage msg, IoSession session) {
		logger.debug("【0xFD 上传补传数据】终端 {} Session {}  ", msg.getTerminalId(), msg.getSessionId());

		// 0x80 指令应答 收到需要应答的数据包
		sendMessageToTerminal(createResponse(msg), session);
		
		// TerminalSupplements tp = (TerminalSupplements)msg;
		//
		// System.out.println(JSON.toJSONString(tp));
		// logger.debug(JSON.toJSONString(tp));
		// timeEventBus.post(new TerminalPositionEvent(new Date(), tp));
	}

}
